<template>
    <el-dialog :visible.sync="visible" title="选择仓库">
      <div>
        <el-select v-model="value">
          <el-option v-for="v in list" :label="v.name" :value="v.id"/>
        </el-select>
      </div>
      <div style="margin-top: 10px;">
        <el-button type="primary" icon="el-icon-edit" @click="confirm">确定</el-button>
      </div>
    </el-dialog>
</template>

<script>
    export default {
        name: "stockChoose",
      data(){
          return {
            visible: false,
            list: [],
            value:""
          }
      },
      methods:{
          init(){
            this.list = []
            this.value = ""
            this.load()
          },
          confirm(){
            this.$emit("ok", this.value)
            this.visible = false
          },
          load(){
            this.$http({
              url: this.$http.adornUrl('/sys/storage/stockList'),
              method: 'get',
              params: this.$http.adornParams()
            }).then(({data}) => {
              this.list = data
            })
          },
        show(){
            this.visible = true
        },
      },
      mounted() {
          this.init()
      }
    }
</script>

<style scoped>

</style>
